<?php
include("include/config.inc.php");
$q = strtolower($_GET["q"]);
if (!$q) return;
$selectPartyQry = "SELECT partyId,partyName
                     FROM party 
                    WHERE partyName REGEXP '$q'";
$selectPartyQryRes = mysql_query($selectPartyQry);
if(mysql_num_rows($selectPartyQryRes) > 0)
{
  while($partyRow = mysql_fetch_array($selectPartyQryRes)) 
  {
  	echo $partyRow['partyName'].'|'.$partyRow['partyId']."\n";
  }
}
else
{
	echo "";
}
?>